// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   AuthFilter.java

package dale.web.core.filter;

import dale.web.core.util.AuthHttpUtils;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;

public class AuthFilter
    implements Filter
{

    public AuthFilter()
    {
    }

    public void init(FilterConfig filterconfig)
        throws ServletException
    {
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException
    {
        HttpServletRequest httpRequest = (HttpServletRequest)request;
        String servletPath = httpRequest.getServletPath();
        if(StringUtils.equals("/user/userLogIn", servletPath) || AuthHttpUtils.hasUserSession(httpRequest))
        {
            chain.doFilter(request, response);
        } else
        {
            RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/views/error.jsp");
            dispatcher.forward(request, response);
        }
    }

    public void destroy()
    {
    }
}
